/*!
\copyright  Copyright (c) 2023 Qualcomm Technologies International, Ltd.\n
            All Rights Reserved.\n
            Qualcomm Technologies International, Ltd. Confidential and Proprietary.
\file       
\brief      Peer status events
*/

#ifndef PEER_STATUS_CHANNEL_EVENT_SPEC_H_
#define PEER_STATUS_CHANNEL_EVENT_SPEC_H_

#include "channel_event_spec_ids.h"
#include <bdaddr.h>

/*! \brief The peer status event channel */
#define EVENT_BUS_CHANNEL_PEER_STATUS  peer_status_event_channel

/*! \brief The peer status events */
typedef enum
{
    peer_pairing_started,
    peer_pairing_complete,
    peer_pairing_failure,

    peer_connecting_started,
    peer_connecting_acl_connected,
    peer_connecting_complete,
    peer_connecting_failed,
    peer_disconnected,
    
    peer_role_swap_initiated,
    peer_role_swap_complete,
    peer_role_swap_failed,
} peer_status_event_t;

/*! \brief The data sent with peer_status_event_t events. */
typedef struct
{
    bdaddr peer_addr;
}  peer_status_event_data_t;

typedef peer_status_event_data_t peer_pairing_started_t;
typedef peer_status_event_data_t peer_pairing_complete_t;

typedef enum
{
    reason_for_peer_pairing_failure_unknown,
} peer_pairing_failure_reason_t;

typedef struct 
{
    bdaddr peer_addr;
    peer_pairing_failure_reason_t reason;
} peer_pairing_failure_t;

typedef peer_status_event_data_t peer_connecting_started_t;
typedef peer_status_event_data_t peer_connecting_acl_connected_t;
typedef peer_status_event_data_t peer_connecting_complete_t;

typedef enum
{
    reason_for_peer_connecting_failure_unknown,
} peer_connecting_failed_reason_t;

typedef struct 
{
    bdaddr peer_addr;
    peer_connecting_failed_reason_t reason;
} peer_connecting_failed_t;

typedef peer_status_event_data_t peer_disconnected_t;

typedef enum
{
    primary_role,
    secondary_role,
} role_t;

typedef struct 
{
    bdaddr peer_addr;
    role_t current_role;
} peer_role_swap_initiated_t;

typedef struct 
{
    bdaddr peer_addr;
    role_t new_role;
} peer_role_swap_complete_t;

typedef enum
{
    reason_for_role_swap_fail_unknown,
    reason_for_role_swap_fail_vetoed,
    reason_for_role_swap_fail_timeout,
} peer_role_swap_failed_reason_t;

typedef struct 
{
    bdaddr peer_addr;
    role_t current_role;
    peer_role_swap_failed_reason_t reason;
} peer_role_swap_failed_t;

#endif